package data;

import java.util.Arrays;

public class Task implements Cloneable {
	private final int actorsNumber;
	private final int scenesNumber;
	
	private final boolean [][] actorsScenesRelation;
	private final float [] actorsSalary;
	
	public Task(int actorsNumber, int scenesNumber, boolean[][] actorsScenesRelation, float [] actorsSalary) {
		if(actorsNumber <= 0 || scenesNumber <= 0)
			throw new IllegalArgumentException("not positive number of actors or scenes");
		this.actorsNumber = actorsNumber;
		this.scenesNumber = scenesNumber;
		
		if(actorsScenesRelation == null || actorsScenesRelation.length != actorsNumber)
			throw new IllegalArgumentException("invalid actors-scenes relation");
		for(int i = 0 ; i < actorsNumber ; ++i)
			if(actorsScenesRelation[i].length != scenesNumber)
				throw new IllegalArgumentException("invalid actors-scenes relation");
		this.actorsScenesRelation = actorsScenesRelation;
		
		if(actorsSalary == null || actorsSalary.length != actorsNumber)
			throw new IllegalArgumentException("invalid actors salary");
		this.actorsSalary = actorsSalary;
		
	}

	public int getActorsNumber() {
		return actorsNumber;
	}

	public int getScenesNumber() {
		return scenesNumber;
	}

	public boolean[][] getActorsScenesRelation() {
		return actorsScenesRelation;
	}

	public float[] getActorsSalary() {
		return actorsSalary;
	}
	
	@Override
	public String toString() {
		return Arrays.toString(actorsSalary) + "\n" + Arrays.deepToString(actorsScenesRelation);
	}
	
	@Override
	public Task clone() {
		Task newTask = new Task(actorsNumber, scenesNumber, actorsScenesRelation, actorsSalary);
		return newTask;
	}
	
}
